<!--

    Copyright © 2016-2024 The Thingsboard Authors

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->
<ng-container [formGroup]="actionButtonWidgetConfigForm">
  <tb-datasources
    *ngIf="!widgetEditMode"
    [configMode]="basicMode"
    hideDatasourceLabel
    hideDataKeys
    forceSingleDatasource
    formControlName="datasources">
  </tb-datasources>
  <div class="tb-form-panel">
    <div class="tb-form-panel-title" translate>widgets.action-button.behavior</div>
    <div class="tb-form-row">
      <div class="fixed-title-width" tb-hint-tooltip-icon="{{'widgets.action-button.on-click-hint' | translate}}" translate>widgets.action-button.on-click</div>
      <tb-widget-action-settings fxFlex
                                 panelTitle="widgets.action-button.on-click"
                                 [callbacks]="callbacks"
                                 [widgetType]="widgetType"
                                 formControlName="onClickAction">
      </tb-widget-action-settings>
    </div>
    <div class="tb-form-row">
      <div class="fixed-title-width" tb-hint-tooltip-icon="{{'widgets.button-state.activated-state-hint' | translate}}" translate>widgets.button-state.activated-state</div>
      <tb-get-value-action-settings fxFlex
                                    panelTitle="widgets.button-state.activated-state"
                                    [valueType]="valueType.BOOLEAN"
                                    stateLabel="widgets.button-state.activated"
                                    [aliasController]="aliasController"
                                    [targetDevice]="targetDevice"
                                    [widgetType]="widgetType"
                                    formControlName="activatedState"></tb-get-value-action-settings>
    </div>
    <div class="tb-form-row">
      <div class="fixed-title-width" tb-hint-tooltip-icon="{{'widgets.button-state.disabled-state-hint' | translate}}" translate>widgets.button-state.disabled-state</div>
      <tb-get-value-action-settings fxFlex
                                    panelTitle="widgets.button-state.disabled-state"
                                    [valueType]="valueType.BOOLEAN"
                                    stateLabel="widgets.button-state.disabled"
                                    [aliasController]="aliasController"
                                    [targetDevice]="targetDevice"
                                    [widgetType]="widgetType"
                                    formControlName="disabledState"></tb-get-value-action-settings>
    </div>
  </div>
  <div class="tb-form-panel">
    <div class="tb-form-panel-title" translate>widget-config.appearance</div>
    <tb-widget-button-appearance
      [borderRadius]="actionButtonWidgetConfigForm.get('borderRadius').value"
      formControlName="appearance">
    </tb-widget-button-appearance>
  </div>
  <div class="tb-form-panel">
    <div class="tb-form-panel-title" translate>widget-config.card-appearance</div>
    <div class="tb-form-row space-between">
      <div>{{ 'widget-config.card-border-radius' | translate }}</div>
      <mat-form-field appearance="outline" subscriptSizing="dynamic">
        <input matInput formControlName="borderRadius" placeholder="{{ 'widget-config.set' | translate }}">
      </mat-form-field>
    </div>
  </div>
</ng-container>
